package com.tzy.note.base.spring;

import java.security.SecureRandom;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class LuckDraw {
    static String[] persons = {"aa","bb","cc","dd","ee"};

    static int luchNum = 3;

    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        for (; ; ) {
            if (set.size() == luchNum) {
                break;
            }
            int ramdom = new SecureRandom().nextInt(persons.length);
            set.add(persons[ramdom]);
        }
        Iterator<String> iterator = set.iterator();
        System.out.println("------------十一月大促活动结束抽奖直播------------");
        System.out.println("开奖人:诸葛老师");
        System.out.println("开中奖名单:");
        while (iterator.hasNext()) {
            System.out.printf("中小米机器人的是:%s\r\n", iterator.next());
            System.out.println("恭喜中奖的朋友,请和班主任联系");
        }
    }
}
